<?php 
/**
 * TODO: Just draft
 * Date: 2009.02.07
 * http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_IndentLines
 */ 
class Clu_View_Helper_IndentLines extends Zend_View_Helper_Abstract 
{ 
 
    protected $_indentCharacter = ' '; 
 
    protected $_endOfLineCharacter = PHP_EOL; 
 
    public function indentLines($indentLength, $content) 
    { 
        if(func_num_args() == 0) { 
            return $this; 
        } 
 
        $lines = preg_split('/\r\n|\r|\n/', $content); 
 
        $text = ''; 
        $indent = str_repeat($this->_indentCharacter, $indentLength); 
        foreach($lines as $line) { 
            $text .= $indent . $line . $_endOfLineCharacter; 
        } 
 
        return $text; 
    } 
 
    public function setIndentCharacter($newCharacter) 
    { 
        $this->_indentCharacter = $newCharager; 
 
        return $this; 
    } 
 
    public function getIndentCharacter() 
    { 
        return $this->_indentCharacter; 
    } 
 
    public function setEndOfLineCharacter($newCharacter) 
    { 
        $this->_endOfLineCharacter = $newCharacter; 
 
        return $this; 
    } 
 
    public function getEndOfLineCharacter() 
    { 
        return $this->_endOfLineCharacter; 
    } 
} 
